<?php
/**
 * Created by PhpStorm.
 * User: tjjs
 * Date: 17-5-19
 * Time: 上午11:38
 */

namespace ActionsHttp;


use Data\Food_groups;
use Data\Food_groups_DAO;

class RestaurantFoodGroupsAdd extends BaseActionHttp
{
    public function doAction() {

        parent::doAction();

        // 商铺id
        $restaurant_id = $_SESSION[RESTAURANT_ID];
        $restaurant_id = 1;


        // 分类名称
        $name = $this->data[FOOD_GROUP_NAME];
        // 分类描述
        $description = $this->data[DESCRIPTION];

        // 新建分类
        $food_groups_record = new Food_groups(array());

        $food_groups_record->setRESTAURANT_ID($restaurant_id);
        $food_groups_record->setFOOD_GROUP_NAME($name);
        $food_groups_record->setDESCRIPTION($description);

        // 插入数据库
        Food_groups_DAO::insert($food_groups_record);

        // 返回数据
        $this->ResponseDataToCurrentClient();
    }
}